package day01;

import java.util.Scanner;

public class ZT3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        int len = s.length();
        int count = 0;
        for (int i = 0; i < len; i++) {
            if (s.charAt(i) == '0' || s.charAt(i) == '9' || s.charAt(i) == '6') {
                count++;
            } else if (s.charAt(i) == '8') {
                count += 2;
            }
        }
        System.out.print(count);
    }
}
